USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[WeaponsSelectKillTop5MeleeWeapons]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.WeaponsSelectKillTop5MeleeWeapons
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/12/08
-- Description:	Weapons Table Select - Top 5 Killers with Melee Weapons
-- =============================================
CREATE PROCEDURE WeaponsSelectKillTop5MeleeWeapons

AS

BEGIN

SELECT  TOP 5  PlayerName, count(killid) as [Kills], PlayerId FROM Kills
INNER JOIN PlayerNameList ON attacker_playerid = PlayerNameList.PlayerID
 where 
Attacker_Weaponid IN (SELECT WeaponId FROM Weapons WHERE WeaponShortName 
IN (
'bat',
'shovel',
'axe',
'axtinguisher',
'bottle',
'fists',
'gloves',
'wrench',
'knife',
'bonesaw',
'ubersaw',
'club'
))

group by Attacker_PlayerId, PlayerName, PlayerId
order by [Kills] DESC

END
GO

--  WeaponsSelectKillTop5MeleeWeapons
